<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>webgl着色器</title>
  <script src="lib/webgl-debug.js"></script>
  <script src="lib/webgl-utils.js"></script>
  <script src="lib/cuon-utils.js"></script>
  <script src="lib/cuon-matrix.js"></script>
</head>
<body onload="main()">
  <canvas id="canvas" width="400" height="490"></canvas>
</body>
<script>

var vShder_source =`
void main(){
  gl_Position =vec4(0.0,0.0,0.0,1.0); //设置坐标
  gl_PointSize =10.0; //设置尺寸
}
`
var fShder_source =`
void main(){
  gl_FragColor = vec4(0.5,0.0,0.0,1.0);//设置颜色
}
`

  function main(){
    var canvas = document.getElementById('canvas');
    var gl = getWebGLContext(canvas);
    if(!initShaders(gl,vShder_source,fShder_source)){
      return;
    }
    gl.clearColor(1.0,1.0,1.0,1.0);
    gl.clear(gl.COLOR_BUFFER_BIT);
    gl.drawArrays(gl.POINTS,0,1);
  }
</script>
</html>